<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>自适应剩余高度</title>
  <style>
    body {
      margin: 0;
      padding: 0;
    }

    #root {
      display: flex;
      flex-direction: column;
      height: 100vh;
    }

    header {
      height: 50px;
      /* flex: 0 0 auto; */
      background: orange;
    }

    main {
      flex-grow: 1;
      background-color: blueviolet;
    }

  </style>
</head>

<body>
  <div id="root">
    <header>
      test
    </header>
    <main>
      content
    </main>
  </div>
</body>

</html>
